#!/usr/bin/env bash
set -euo pipefail

# prepare binary wheels in dist
# expects dist to have comipled binary versions
# required params: version
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#platform-compatibility-tags

# clean start
rm -rf dist/binary_dist

# basic
cp -r binary_dist dist/binary_dist
cp LICENSE.md dist/binary_dist/
cp README_PYPI.md dist/binary_dist/

cp dist/icloudpd-$1-windows-amd64.exe dist/binary_dist/src/icloudpd/icloudpd
cp dist/icloud-$1-windows-amd64.exe dist/binary_dist/src/icloud/icloud
python3 -m pip wheel dist/binary_dist/ -w dist/binary_dist --no-deps --no-build-isolation

mv -f dist/binary_dist/icloudpd-$1-py2.py3-none-any.whl dist/icloudpd-$1-py2.py3-none-win_amd64.whl